﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Ketnoidulieu
{
    public partial class BTtr192 : Form
    {
        public BTtr192()
        {
            InitializeComponent();
        }

        clssQLDiem obj = new clssQLDiem();
        DataSet ds = new DataSet();
        Boolean flag = false;
        DataView dv = new DataView();

        private void BTtr192_Load(object sender, EventArgs e)
        {
            ds = obj.laydulieulopsv();
            cbblop.DataSource = ds.Tables["lop"];
            cbblop.DisplayMember = "tenlop";
            cbblop.ValueMember = "malop";
            cbblop.SelectedIndex = -1;
            dv.Table = ds.Tables["sv"];
            dv.Sort = "tensv";
            flag = true;
        }

        private void cbblop_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbblop.SelectedIndex != -1 && flag==true)
            {
                string malop = cbblop.SelectedValue.ToString();
                dv.RowFilter = "malop='" + malop + "'";
                dgvlop.DataSource = dv;
            }
        }
    }
}
